﻿<%@ Page Language="C#" AutoEventWireup="true" Codebehind="PopupResponsibilityTransfer.aspx.cs"
    Inherits="MTRC.ODMS.Web.SOM.Popup.PopupResponsibilityTransfer" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControlToolkit" %>
<%@ Register Src="../UserControl/UCSignatureNew.ascx" TagName="UCSignatureNew" TagPrefix="ucn" %>
<%@ Register Assembly="APJ.Web.UI.WebControls" Namespace="APJ.Web.UI.WebControls"
    TagPrefix="APJ" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Responsibility Transfer</title>
    <link href="<%=ResolveUrl("~/CSS/common.css")%>" rel="stylesheet" type="text/css" />
    <base target="_self" />
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Cache-Control" content="no-cache" />

    <script type="text/jscript" language="JavaScript" src="../../Javascript/CommonFunction.js"></script>
    <script type="text/javascript" src="../../Javascript/Menu/MainMenu.js"></script>
    <!-- add by jack 20150727 for U120 -->
    <link href="<%=ResolveUrl("~/JqueryUICombox/jquery-ui.css")%>" rel="stylesheet" type="text/css" />
    <script src="<%=ResolveUrl("~/jQuery/jquery-1.6.2.min.js")%>"  type="text/javascript"></script>
    <script src="<%=ResolveUrl("~/JqueryUICombox/jquery-ui.js")%>" type="text/javascript"></script>
    <script src="<%=ResolveUrl("~/JqueryUICombox/combox_noclear.js")%>" type="text/javascript"></script>
    <!-- ****************************** -->
    <script type="text/jscript">
        function SetHdnIsValueFromPopupValue()
        {
            document.getElementById("hdnIsValueFromPopup").value = 'N';  //add by hzx on 20090105 change 0824
            //may set hdnExtPartyStaffSnapShotID value to '0' or ''
        }
        function  OpenStaffContractorForm()
        {
           var strURL = "../Popup/PopupSearchStaff.aspx?PageID=ResponsibilityTransfer"
           window.showModalDialog(strURL, window, "DialogWidth:740px;DialogHeight:520px;help:no;status:no");
           document.getElementById("hdnIsValueFromPopup").value = 'Y'; //add hzx on 20090105
           //---------added by huangyao 20090107
           __doPostBack(document.getElementById("hdnStaffType").id, ""); //trigger oField's event
           //----end-----added by huangyao 20090107
        }
        function OpenQualificationForm()
        {
           var StaffID=encodeURI(document.getElementById("txtStaffID").value); ////--huangyao:20090312:this method need pass Chinese Char, so only can bind the event in background
           var EventPersonTypeID=document.getElementById("hdnStaffType").value;
           var PersonHoldQualKye=document.getElementById("hdnPersonHoldQualKye").value;
           //begin alter by hzx, on 20090115
//           if(PersonHoldQualKye=="" && window.dialogArguments.form1.hdnPersonHoldQualKye.value!="")
//           {
//             PersonHoldQualKye= window.dialogArguments.form1.hdnPersonHoldQualKye.value;
//           }   
//           if (document.getElementById("hdnStaffChanged").value=="TRUE")
//           {
//             PersonHoldQualKye="";
//           }
           //end
           
           if (StaffID=="")
           {
                alert(document.getElementById("hdnErrMsg").value);
                return false;
            }

           var strURL = "../Popup/PopupQualification.aspx?EventPersonTypeID="+EventPersonTypeID+"&StaffID="+StaffID+"&PersonHoldQualKye=" + PersonHoldQualKye;
           window.showModalDialog(strURL, window, "DialogWidth:660px;DialogHeight:520px;help:no;status:no");
           document.getElementById("hdnQualification").value=document.getElementById("hdnPersonHoldQualKye").value; 
        }  
        
        function SaveKey(TrKey,QualKey,QualValue,objStaffid,objStaffName,objDepartmentCompany,objOrgUnit,objConactNo,objStaffType,objExtPartyStaffSnapShotID) //"objExtPartyStaffSnapShotID" add by hzx,20090104
        {
            window.dialogArguments.form1.hdnTransferResponsibilityKey.value=TrKey;  
            if(objStaffType==3 || objStaffType==4)
            {
                QualKey = "";
                window.dialogArguments.form1.hdnIsValueFromPopup.value = "Y";
                window.dialogArguments.form1.hdnDepartmentCompany.value = objDepartmentCompany;
            }
            window.dialogArguments.form1.hdnPersonHoldQualKye.value = QualKey;
            window.dialogArguments.form1.txtStaffID.value=objStaffid;
            window.dialogArguments.form1.txtStaffName.value=objStaffName;
            //window.dialogArguments.form1.txtDepartmentCompany.value=objDepartmentCompany; 
            window.dialogArguments.form1.txtSelectedOU.value = objDepartmentCompany; 
            window.dialogArguments.form1.txtOrganizationUnit.value=objOrgUnit;
            window.dialogArguments.form1.txtContactNo.value=objConactNo;
            window.dialogArguments.form1.hdnStaffType.value=objStaffType;  
            window.dialogArguments.form1.hdnTransferChange.value="1";   
            window.dialogArguments.form1.hdnExtPartyStaffSnapShotID.value=objExtPartyStaffSnapShotID; //add by hzx 20090104         
            var pForm= window.dialogArguments.form1;
            window.dialogArguments.__doPostBack(pForm.hdnTransferResponsibilityKey.id, "");
            window.dialogArguments.IsServerChanged = true;
            window.dialogArguments.form1.hdnTransferStatus.value = "1"; //Add by jack 20151209 u288 Fixed Transfer Time is missing
            window.close();         
        }
        
        function ColseForm()
        {
           document.getElementById("btnCancel").click();
           window.close();
        }
        
        function IsTel(val)
        {          
	        var str="[0-9-\\s]*";
	        var re=new RegExp(str);
	        var temp=re.exec(val);
	        if (temp==trim(val))
		        return true;
	        else
		        return false;
        } 
        
        var ErrMsgTel='<%=this.GetMessage("SOM_TelError")%>';
         
        function CheckTel(obj)
        {
          if (trim(obj.value)!="" && !IsTel(obj.value))
          {
            obj.value="";
            alert(ErrMsgTel);
            return false;
          }
          else
          {
           return true;
          }
        }

        /* add by jack 20150727 for U120 */

        $(function () {
            InitCombobox();
        });

        function InitCombobox() {
            $(".combobox").combobox();
            $("#toggle").click(function () {
                $(".combobox").toggle();
            });
            $(".custom-combobox").css({ "height": "20px" });
            $(".custom-combobox input").css({ "width": "254px", "height": "18px", "line-height": "18px" });
            $(".custom-combobox a").css({ "width": "16px", "height": "20px", "position": "relative", "top": "-4px", "left": "-1px" });
            

            if ($("#txtSelectedOU").val() != "") {
                $(".custom-combobox input").val($("#txtSelectedOU").val());
            }

            if (document.getElementById("hdnStaffType").value == 1 || document.getElementById("hdnStaffType").value == 3) {
                $(".custom-combobox input").attr("readonly", "readonly");
            }

            //Add by jack 20151203 U288 when statusid=2(completed),then disabled the control
            if (dialogArguments.document.getElementById("hdnStatus").value == "2") {
                document.getElementById('<%=btnTransSave.ClientID %>').disabled = true;
                document.getElementById('<%=txtStaffID.ClientID %>').disabled = true;
                document.getElementById('<%=imgSearchStaff.ClientID %>').disabled = true;
                document.getElementById('<%=txtStaffName.ClientID %>').disabled = true;
                document.getElementById('<%=txtDepartmentCompany.ClientID %>').disabled = true;
                document.getElementById('newCompany').disabled = true;
                document.getElementById('<%=txtOrganizationUnit.ClientID %>').disabled = true;
                document.getElementById('<%=txtContactNo.ClientID %>').disabled = true;
                document.getElementById('<%=ddlQualification.ClientID %>').disabled = true;
                document.getElementById('ucSignature_btnPhotoCapture').disabled = true;
                document.getElementById('ucSignature_btnHandWritten').disabled = true;
                document.getElementById('ucSignature_imgSignature').disabled = true; //Update by jack 20151207 U288 Fixed User should be able to view the signature
            }
            //End add by jack 20151203 U288 when statusid=2(completed),then disabled the control
        }
        // add by jack 20151119 for u284 mouseout do not query data
        function TextChanged(obj) {
            if (obj.fireEvent) {
                obj.fireEvent('onchange');
            }
            else {
                obj.onchange();
            }
        }
        /********************************/
    </script>
    <link href="" rel="stylesheet" type="text/css" />
    <link href="" rel="stylesheet" type="text/css" />
    <link href="" rel="stylesheet" type="text/css" />

</head>
<body style="margin-top: 5px; padding-left: 0px; margin-left: 10px; padding-top: 0px;
    padding-right: 0px; margin-right: 0px; width: 95%; height: 100%">
    <form id="form1" runat="server" style="height: 100%">
        <AjaxControlToolkit:ToolkitScriptManager ID="ToolkitScriptManager" runat="server">
        </AjaxControlToolkit:ToolkitScriptManager>      
        <div>
            <table width="100%">
                <tr>
                    <td>
                        <fieldset>
                            <legend>
                                <%=GetLabel("SOM_Relinquish",false)%>
                            </legend>
                            <table id="tblUpdate" style="width: 100%">
                                <tr>
                                    <td style="width: 20%">
                                        <%=GetLabel("COM_StaffID", true)%>
                                    </td>
                                    <td style="width: 30%">
                                        <asp:Label ID="lblStaffIdValue" runat="server" Style="text-align: left; direction: ltr;"></asp:Label></td>
                                    <td style="width: 15%">
                                        <%=GetLabel("COM_StaffName", true)%>
                                    </td>
                                    <td style="width: 35%">
                                        <asp:Label ID="lblStaffNameValue" runat="server" Style="text-align: left; direction: ltr;"></asp:Label></td>
                                </tr>
                                <tr>
                                    <td>
                                        <%=GetLabel("SOM_DepartmentCompany", true)%>
                                    </td>
                                    <td>
                                        <asp:Label ID="lblDeptCompanyValue" runat="server" Style="text-align: left; direction: ltr;"></asp:Label></td>
                                    <td>
                                        <%--<%=GetLabel("SOM_OrgUnit", true)%>--%>
                                        <%=GetLabel("COM_ContactNo", true)%>
                                    </td>
                                    <td>
                                        <asp:Label ID="lblOrgUnitValue" runat="server" Style="text-align: left; direction: ltr; display:none;"></asp:Label>
                                        <asp:Label ID="lblContactNoValue" runat="server" Style="text-align: left; direction: ltr;"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                         <%=GetLabel("SOM_Qualification", true)%>
                                    </td>
                                    <td>
                                        <asp:Label ID="lblQualificationValue" runat="server" Style="text-align: left; direction: ltr;"></asp:Label></td>
                                    <td>
                                         <%=GetLabel("SOM_TransferTime", true)%>
                                    </td>
                                    <td>
                                         <asp:Label ID="lblTransferTimeValue" runat="server" Style="text-align: left; direction: ltr;"></asp:Label>
                                    </td>
                                </tr>
                            </table>
                        </fieldset>
                        <br />
                        <fieldset>
                            <legend>
                                <%=GetLabel("SOM_Succession")%>
                            </legend>
                            <asp:UpdatePanel runat="server" ID="updatePanelEstimateHrs" UpdateMode="Conditional">
                            <ContentTemplate>
                            <div id="Div1" style="width: 100%; padding-left: 10px; padding-right: 10px; padding-top: 5px;padding-bottom: 1px;">
                            <div id="ThirdRow" style="float: left; width: 50%;">
                                <div style="float: left; width: 100%;padding-top: 10px; padding-bottom: 1px;">
                                    <div style="float: left; width: 30%;">
                                        <%=GetLabel("COM_StaffID", true)%>
                                        <em>*</em>
                                    </div>
                                    <div style="float: left; width: 69%;">
                                        <asp:Image ID="imgStaffType" runat="server" ImageUrl="../../Images/SOM/StaffType_Staff.gif" ToolTip='<%# GetLabel("SOM_TransSave")%>' />
                                        <input type="hidden" id="hdnStaffType" name="hdnStaffType" runat="server" onserverchange="hdnStaffType_ServerChange" />
                                        <input type="hidden" id="hdnIsValueFromPopup" name="hdnIsValueFromPopup" runat="server" value="N" /> <%--//add by hzx on 20090105 change 20090105--%>
                                        <asp:TextBox ID="txtStaffID" runat="server" Width="210px" MaxLength="40" Text="" onkeyup="SetHdnIsValueFromPopupValue();" onblur="TextChanged(this);" OnTextChanged="txtStaffID_TextChanged" AutoPostBack="True"></asp:TextBox>&nbsp;
                                        <asp:ImageButton ID="imgSearchStaff" ImageUrl="../../Images/Common/view.png" runat="server" OnClientClick="OpenStaffContractorForm(); return false;" ToolTip='<%# GetLabel("SOM_TransSave")%> ' />
                                        <input id="hdnExtPartyStaffSnapShotID" type="hidden" runat="server" />
                                    </div>
                                </div>
                                <div style="float: left; width: 100%;padding-top: 10px; padding-bottom: 1px;">
                                    <div style="float: left; width: 30%;">
                                        <%=GetLabel("COM_StaffName", true)%>
                                        <em>*</em>
                                    </div>
                                    <div style="float: left; width: 69%;">
                                        <asp:TextBox ID="txtStaffName" runat="server" MaxLength="50" Width="269"></asp:TextBox>
                                    </div>
                                </div>
                                <div style="float: left; width: 100%;padding-top: 10px; padding-bottom: 1px;">
                                    <div style="float: left; width: 30%;">
                                        <%=GetLabel("SOM_DepartmentCompany", true)%>
                                        <em>*</em>
                                    </div>
                                    <div style="float: left; width: 69%;">
                                        <%-- Update by jack 20150727 for U120 --%>
                                        <%--<asp:TextBox ID="txtDepartmentCompany" runat="server" MaxLength="50" Width="180"></asp:TextBox>--%>
                                        <span id="oldCompany" style="display: none;" runat="server">
                                            <asp:TextBox ID="txtDepartmentCompany" runat="server" MaxLength="50" Width="269"></asp:TextBox>
                                        </span>
                                        <div id="newCompany" class="ui-widget" style="height:30px; padding-top:2px;" runat="server">
                                            <asp:DropDownList ID="ddlDepartmentCompany" runat="server" CssClass="combobox" Width="195" OnSelectedIndexChanged="ddlDepartmentCompany_SelectedIndexChanged" AutoPostBack="True" TabIndex="13">
                                            </asp:DropDownList>
                                            <asp:HiddenField runat="server" ID="txtSelectedOU" ClientIDMode="Static" />
                                        </div>
                                        <%--**********************************--%>
                                    </div>
                                </div>
                                <div style="float: left; width: 100%;padding-top: 10px; padding-bottom: 1px;">
                                    <div style="float: left; width: 30%;">
                                        <span style="display:none;">
                                        <%=GetLabel("SOM_OrgUnit", true)%>
                                        <label runat="server" id="lblEm" visible="false">
                                            <em>*</em></label>
                                        </span>
                                        <%=GetLabel("COM_ContactNo", true)%>
                                        <em>*</em>
                                    </div>
                                    <div style="float: left; width: 69%;">
                                        <span style="display:none;"><asp:TextBox ID="txtOrganizationUnit" runat="server" ReadOnly="true" MaxLength="50" Width="195"></asp:TextBox></span>
                                        <asp:TextBox ID="txtContactNo" runat="server" MaxLength="50" Width="269"></asp:TextBox><%--onblur="CheckTel(this)"--%>
                                    </div>
                                </div>
                                <div style="float: left; width: 100%;padding-top: 10px; padding-bottom: 1px;">
                                <div style="float: left; width: 30%;">
                                <%=GetLabel("SOM_Qualification", true)%>
                                <div style="display:none;"><asp:Label ID="lblMustInput" runat="server" ForeColor="Red" Text="*" Width="1px" Enabled="False" Visible="False"></asp:Label></div>
                                </div>
                                <div style="float: left; width: 69%;">
                                <div style="float: left; width: 99%; ">
                                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                        <ContentTemplate>
                                        <div style="float:left; display:none;">
                                        <input type="hidden" runat="server" id="hdnStationEventPersonQualID" />
                                        <asp:Label ID="lblQualificationFlag" runat="server"></asp:Label>
                                        </div>
                                        <span id="oldQualification" runat="server" style="display:none;">
                                            <asp:TextBox ID="txtQualValue" runat="server" ReadOnly="true" Rows="4" TextMode="MultiLine"
                                                 Width="243"></asp:TextBox>
                                            <asp:Button ID="btnQualification" runat="server" Text="..." OnClientClick="OpenQualificationForm();" />
                                            <input type="hidden" id="hdnQualification" name="hdnQualification" runat="server" />
                                        </span>
                                        <div id="newQualification" runat="server" style="float:left;">
                                            <asp:DropDownList ID="ddlQualification" runat="server" Width="275" OnSelectedIndexChanged="ddlQualification_SelectedIndexChanged" AutoPostBack="True" TabIndex="13">
                                            </asp:DropDownList>
                                        </div>
                                        </ContentTemplate>
                                        </asp:UpdatePanel>
                                    </div>
                                </div>
                                </div>
                            </div>
                            <div id="Div2" style="float: right; width: 50%;">
                            <div style="float: left; width: 25%;">
                            <asp:Label ID="lblSignature" runat="server"></asp:Label>
                            	<%--Modify by elvis on 20180213 for SER-2018056 （default not load  SignaturePaint.）--%>
	                            <%--<em>*</em>--%>
                                 <em id="emSignMust" runat="server" visible="false">*</em>
                            </div>
                            <div style="float: left; width: 74%;">
                                        <input type="hidden" id="hdnSignPathProto" name="hdnSignPathProto" runat="server" value='' />
                                        <input type="hidden" id="hdnSignTypeProto" name="hdnSignTypeProto" runat="server" value='' />
                                        <ucn:UCSignatureNew ID="ucSignature" runat="server" />
                            </div>
                            </div>
                            </div>
                            
                            <input type="hidden" id="hdnPersonHoldQualKye" runat="server" />
                            <input type="hidden" id="hdnStaffChanged" value="FALSE" runat="server" />
                            <input type="hidden" id="hdnErrMsg" runat="server" />
                            <input type="hidden" id="hdnOldStaffType" runat="server" />
                            </ContentTemplate>
                            </asp:UpdatePanel>
                        </fieldset>
                        <br />
                        <fieldset>
                            <legend>
                                <%=GetLabel("SOM_TRHistory")%>
                            </legend>&nbsp;
                            <table style="width: 100%">
                                <tr>
                                    <td>
                                        <div>
                                            <APJ:CommonGridView ID="grdTrHistory" runat="server" AllowPaging="True" AllowSorting="True"
                                                AscPic="~/Images/Common/arrow_up_green.png" AutoGenerateColumns="False" BorderColor="black"
                                                CssClass="GridView" DescPic="~/Images/Common/arrow_down_green.png" OnNeedDataBind="grdTrHistory_NeedDataBind"
                                                OnRowDataBound="grdTrHistory_RowDataBound">
                                                <PagerSettings Position="Bottom" />
                                                <Columns>
                                                    <asp:TemplateField HeaderText="SOM_TransferDateTime" SortExpression="TransferDateTime">
                                                        <itemstyle width="110px" />
                                                        <itemtemplate>
                                                           <%# FormatDateTime(Eval("TransferDateTime"), true)%>
                                                        </itemtemplate>
                                                    </asp:TemplateField>                                                  
                                                    <asp:BoundField DataField="StaffID" HeaderText="COM_StaffID" SortExpression="StaffID" />
                                                    <asp:BoundField DataField="StaffName" HeaderText="COM_StaffName" SortExpression="StaffName" />
                                                    <asp:BoundField DataField="DepartmentCompany" HeaderText="SOM_DepartmentCompany"
                                                        SortExpression="DepartmentCompany" />
                                                        <%-- delete by jack 20150727 for U120 --%>
                                                    <%--<asp:BoundField DataField="OrgUnit" HeaderText="SOM_OrgUnit" SortExpression="OrgUnit" />--%> 
                                                    <asp:BoundField DataField="ContactNo" HeaderText="COM_ContactNo" SortExpression="ContactNo" />
                                                    <asp:BoundField DataField="Qualification" HeaderText="SOM_Qualification" SortExpression="Qualification" />
                                                </Columns>
                                                <RowStyle CssClass="GridView_Row"></RowStyle>
                                                <HeaderStyle CssClass="GridView_Header"></HeaderStyle>
                                                <AlternatingRowStyle CssClass="GridView_AlternativeRow"></AlternatingRowStyle>
                                            </APJ:CommonGridView>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </fieldset>
                    </td>
                </tr>
                <tr>
                    <%-- modified by liuyu 2016/03/15 for IE11 Compatibility Project PI-2015050--%>    
                    <%--<td>
                        <asp:Button ID="btnCancel" runat="server" Text='<%# this.GetLabel("COM_Cancel")%>'
                            Style="float: right" OnClientClick="ColseForm()" OnClick="btnCancel_Click" />
                        <asp:Button ID="btnTransSave" runat="server" Text='<%# this.GetLabel("SOM_TransSave")%>'
                            Style="float: right" OnClick="btnTransSave_Click" />
                    </td>--%>
                    <td align="right">
                        <asp:Button ID="btnCancel" runat="server" Text='<%# this.GetLabel("COM_Cancel")%>'
                             OnClientClick="ColseForm()" OnClick="btnCancel_Click" />
                        <asp:Button ID="btnTransSave" runat="server" Text='<%# this.GetLabel("SOM_TransSave")%>'
                             OnClick="btnTransSave_Click" />
                    </td>

                </tr>
                <tr>
                    <td>
                         <asp:Button ID="hidBtton" runat="server" Height="16px" Text="Button" ClientIDMode="Static"
                  Width="16px" onclick="hidBtton_Click" style="display:none" />
                        </td>
                </tr>
            </table>
        </div>
    </form>
</body>
</html>
